
//
// 110805 - AH - Created.
//

package org.soekrat.gui.swing.chat.objectconversation.note;

import org.soekrat.engine.pit.Content;
import org.soekrat.engine.pit.Node;

/**
 * <p>
 *   Utility methods for working with notes.
 * </p>
 * @author Arne Halvorsen (AH)
 * @author Laetitia Le Chatton (LLC) 
 */
public final class NoteUtil 
{
  private NoteUtil(){} // Utility pattern dictates private constructor.
  
  /**
   * <p>
   *   Gets note
   *   {@link Content} for a given 
   *   {@link Node} in the context of a named ontology.
   * </p>
   * @param node     {@code Node}.
   * @param ontology Name on ontology.
   * @return Content with note or {@code null} if non found.
   */
  public static Content getNoteContent(Node node, String ontology)
  {
    Content[] content=node.getContent(ontology);
    for (Content curr : content)
    {
      if (curr.isNote()) return curr;  
    }
    return null;
  }
  
}
